<template>
	<view class="page-fill">
		
		<view class="page-block info-list">
			<block v-for="(map,i) in  listData" :key="i" >
			<view class="item-wapper" v-for="(key,index) in Object.keys(map)" :key="index" @tap="navTo(map)"  >
				<view class="info-words">{{key}}</view>
				<view class="right-wapper">
					<view class="gray-fields" v-if="Object.values(map)[index]==null"  >
						未绑定
					</view>
					<view class="gray-fields" v-if="Object.values(map)[index]!=null" >
						绑定
					</view>
					<view class="arrow-block">
						<image src="/static/setting/left-gray-arrow.png" class="arrow-ico"></image>
					</view>
				</view>
			</view>
			
			<view class="line-top">
				<view class="line"></view>
			</view>
			</block>
			
		</view>	
		
	</view>
</template>

<script>
	import {
		getHyPaymentBdqk
	} from '@/services/user.service.js'

	export default {
		data() {
			return {
				listData:[]
			};
		},
		onShow() {
			var that = this;
			that.checkToken();
		},
		methods: {
			navTo(map){
				var me = this;
				var type=Object.keys(map)[0];
				var object=Object.values(map)[0];
				var url="";
				if(object==null)
					url='bangding?type='+Object.keys(map)[0]+'&id=0';
				else
					url='bangding?type='+Object.keys(map)[0]+'&id='+object.id;
				
				uni.navigateTo({  
					url:url,
					fail: (e) => {
						console.log(e)
					}
				})  
			},
			
			checkToken() //查用户信息
			{
				var that=this;
				 uni.getStorage({
				    key: 'token',
				    success: function (res) {
						
						that.getAccounts(res.data);
				    },
					fail:function(error){
						uni.navigateTo({
							url: `/pages/login/login`
						})
					}});
			},
			//获取首页通知
			async getAccounts(token){
				const {data}  = await getHyPaymentBdqk()
				this.listData = data;
			},
			
			
		}
	}
</script>

<style>
	/* 页面铺满屏幕 */
	.page-fill {
		width:100%;
		height: 100%;
		position: absolute;
		background-color: #F2F2F2;
	}
	
	.page-block {
		background-color: white;
		margin-top: 30upx;
	}
	
	.info-list {
		/* margin-top: 20upx; */
		padding: 0upx 30upx;
	}
	
	.info-words {
		color: #333333;
		font-size: 28rpx;
		font-weight: 500;
		width: 60%;
		line-height: 80upx;
		/* font-weight: bold; */
	}
	
	.face {
		width: 80upx;
		height: 80upx;
		border-radius: 50%;
	}
	
	.arrow-block {
		margin-left: 10upx;
		line-height: 86upx;
	}
	
	.arrow-ico {
		width: 30upx;
		height: 30upx;
	}
	
	.item-wapper {
		display: flex;
		/* margin-top: 20upx; */
		flex-direction: row;
		justify-content: flex-start;
		border-bottom: 1px solid #DDDDDD;
	}
	
	.face-line-upbottom {
		margin-top: 20upx;
		/* margin-bottom: 20upx; */
		padding-top: 20upx;
		padding-bottom: 20upx;
	}
	
	.line-top {
		/* margin-top: 20upx; */
	}
	
	.right-wapper {
		width: 40%;
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
	}
	
	.gray-fields {
		font-size: 14px;
		color: darkgray;
		line-height: 80upx;
	}
	
	/* 底部操作 start */
	.footer-wapper {
		position: fixed;
		bottom: 30rpx;
		background-color:#12B3F9;
		display: flex;
		flex-direction: column;
		width: 100%;
	}
	.footer-words {
		text-align: center;
		padding: 20upx;
		color: white;
		font-size: 16px;
	}
	/* 底部操作 end */
</style>
